package cn.kgc.aop;

import org.apache.log4j.Logger;
import org.aspectj.lang.JoinPoint;

import java.util.Arrays;

/**
 * Created by Administrator on 2020/2/26.
 */
public class TheLogger {
    private static final Logger logger = Logger.getLogger(TheLogger.class);

    //前置
    public void befor(JoinPoint joinPoint) {
        logger.info("调用了："+joinPoint.getTarget()+"的，"+joinPoint.getSignature().getName()+"方法，入参："
                + Arrays.toString(joinPoint.getArgs()));
    }

    //后置
    public void after(JoinPoint joinPoint, Object result) {
        logger.info("调用了："+joinPoint.getTarget()+"的，"+joinPoint.getSignature().getName()+"方法，返回："+result);
    }
}
